﻿using DataModels.Dto;
using DataModels.Dto.OfflineStore;
using Microsoft.AspNetCore.Mvc;
using Services.OfflineStore;
using Utils;

namespace PropertyManagementWebApi.Controllers.OfflineStore
{
    public class OfflineStoreController(OfflineStoreService offlineStoreService) : BaseController
    {
        protected readonly OfflineStoreService _offlineStoreService = offlineStoreService;

        /// <summary>
        /// 获取所有商品分类
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<ResponseModel> GetOfflineStoreProductCategories()
        {
            return await _offlineStoreService.GetOfflineStoreProductCategories();
        }

        /// <summary>
        /// 获取商品列表
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<ResponseModel> GetOfflineStoreProduct([FromQuery] GetOfflineStoreProductInfo info)
        {
            return await _offlineStoreService.GetOfflineStoreProduct(info);
        }

        /// <summary>
        /// 获取商品详情
        /// </summary>
        /// <param name="OfflineStoreProductUUID"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<ResponseModel> GetOfflineStoreProductDetail([GeneralRequired] Guid OfflineStoreProductUUID)
        {
            return await _offlineStoreService.GetOfflineStoreProductDetail(OfflineStoreProductUUID);
        }

        /// <summary>
        /// 提交订单
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ResponseModel> SubmitOfflineStoreOrder(SubmitOfflineStoreOrderInfo info)
        {
            return await _offlineStoreService.SubmitOfflineStoreOrder(info);
        }
        /// <summary>
        /// 订单支付
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ResponseModel> OfflineStoreOrderPayment(OfflineStoreOrderPaymentInfo info)
        {
            return await _offlineStoreService.OfflineStoreOrderPayment(info);
        }

        /// <summary>
        /// 获取到店订单
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<ResponseModel> GetOrder([FromQuery] GetOrderInfo info)
        {
            return await _offlineStoreService.GetOrder(info);
        }
    }
}
